package database

import (
	_ "embed"
	"errors"
	"gitee.com/zaper/private-logger"
	_ "github.com/go-sql-driver/mysql"
)

//go:embed script/service.sql
var serviceSql string

//go:embed script/sqls.properties
var sqlInfoStr string

func InitializeDB() error {
	dbMgr := GetDataBaseManager()
	err := dbMgr.BatchExecSql(dbMgr.SplitSqlOperations(serviceSql))
	if err != nil {
		logger.Error("InitializeDB sql fail")
		return errors.New("InitializeDB sql fail")
	}
	AddSqlInfos(sqlInfoStr)
	return nil
}
